import axios from 'axios';
import {UserState} from '@/store/modules/user/types';
import {Md5} from 'ts-md5';
import {PageParams, PageRes} from "@/api/common";

const baseUrl = '/sc/role/';
const apis = {
queryPage:`${baseUrl}page`,
delete:`${baseUrl}delete`,
addForm: `${baseUrl}add`,
editForm: `${baseUrl}edit`,
detail: `${baseUrl}detail`,
list:`${baseUrl}list`,
};


export interface RoleModel {
id?:undefined
name?:undefined
isSystem?:undefined
description?:undefined
gmtCreate?:undefined
gmtModified?:undefined
modifiedId?:undefined
createId?:undefined
deleteFlag?:undefined
}


export function queryPage(params: PageParams) {
   return axios.post<PageRes>(apis.queryPage, params);
}

export function removeRow(rowId: string) {
   return axios.delete<string>(`${apis.delete}?id=${rowId}`);
}


export function addForm(param:any) {
   return axios.post<string>(apis.addForm,param);
}

export function editForm(param:any) {
   return  axios.post<string>(apis.editForm,param);
}

export function detail(rowId:string) {
   return axios.get<any>(`${apis.detail}?id=${rowId}`);
}

export function rolesList() {
   return axios.get<any>(`${apis.list}`);
}
